package com.ctg.itrdc.sysmgr.portal.control;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ctg.itrdc.sysmgr.portal.api.dto.PrivilegeDTO;
import com.ctg.itrdc.sysmgr.portal.api.service.IPrivilegeService;
import com.ctg.itrdc.sysmgr.portal.common.entity.CommonResult;

@Controller
@RequestMapping("/privilege")
public class PrivilegeController extends SysmgrCURDController<Long, PrivilegeDTO> {
	
	@Resource
	IPrivilegeService privilegeService;
	
	@RequestMapping("/permissions")
	@ResponseBody
	public CommonResult getPermissions(Long sysUserId, Long sysPostId) {
		List<String> permissions = privilegeService.getPermissions(sysUserId, sysPostId);
		return new CommonResult(HttpStatus.OK.toString(), "" , permissions);
	}
}
